swift_too
moduleSwift_SAA
example - Querying times when Swift is passing through the South Atlantic Anomalyswifttools
version 2.4.2This is a class to determine when Swift will be inside the South Atlantic Anomaly (SAA). During SAA passages, all instruments are turned off. There are two SAA definitions, the default is the Spacecraft SAA definition which is used by the Swift X-ray Telescope (XRT) and UV/Optical Telescope (UVOT). The second is an approximation of the Burst Alert Telescope (BAT) SAA time. As BAT self determines if it is in the SAA based on rates, the BAT SAA is based on a model that predicts when this should happen.
from swifttools.swift_too import SAA
In order to query when Swift will be going through the SAA on a particular day, just call as follows:
saa = SAA('2022-03-30')
saa
# | Begin | End |
---|---|---|
0 | 2022-03-30 00:00:00 | 2022-03-30 00:14:52 |
1 | 2022-03-30 10:30:56 | 2022-03-30 10:38:45 |
2 | 2022-03-30 12:07:36 | 2022-03-30 12:29:02 |
3 | 2022-03-30 13:46:03 | 2022-03-30 14:10:57 |
4 | 2022-03-30 15:24:52 | 2022-03-30 15:51:18 |
5 | 2022-03-30 17:04:51 | 2022-03-30 17:31:00 |
6 | 2022-03-30 18:46:35 | 2022-03-30 19:10:39 |
7 | 2022-03-30 20:28:38 | 2022-03-30 20:50:18 |
8 | 2022-03-30 22:10:30 | 2022-03-30 22:29:49 |
9 | 2022-03-30 23:53:01 | 2022-03-31 00:00:00 |
As can be seen able, the returned value is a table of SAA begin
and end
times. The default first parameter passed to SAA above is begin
. For this request length
defaults to 1 day, so the value of end
is automatically set to 2022-03-30
. You can set begin
, end
and length
by hand if you wish.
So an alternative way to do the above could be:
SAA('2022-03-29','2022-03-30')
# | Begin | End |
---|---|---|
0 | 2022-03-29 00:07:09 | 2022-03-29 00:24:03 |
1 | 2022-03-29 12:15:50 | 2022-03-29 12:35:52 |
2 | 2022-03-29 13:54:10 | 2022-03-29 14:18:32 |
3 | 2022-03-29 15:32:57 | 2022-03-29 15:59:06 |
4 | 2022-03-29 17:12:22 | 2022-03-29 17:38:55 |
5 | 2022-03-29 18:53:52 | 2022-03-29 19:18:31 |
6 | 2022-03-29 20:36:01 | 2022-03-29 20:58:14 |
7 | 2022-03-29 22:17:53 | 2022-03-29 22:37:45 |
8 | 2022-03-29 23:59:55 | 2022-03-30 00:00:00 |
or
SAA('2022-03-29',length=1)
# | Begin | End |
---|---|---|
0 | 2022-03-29 00:07:09 | 2022-03-29 00:24:03 |
1 | 2022-03-29 12:15:50 | 2022-03-29 12:35:52 |
2 | 2022-03-29 13:54:10 | 2022-03-29 14:18:32 |
3 | 2022-03-29 15:32:57 | 2022-03-29 15:59:06 |
4 | 2022-03-29 17:12:22 | 2022-03-29 17:38:55 |
5 | 2022-03-29 18:53:52 | 2022-03-29 19:18:31 |
6 | 2022-03-29 20:36:01 | 2022-03-29 20:58:14 |
7 | 2022-03-29 22:17:53 | 2022-03-29 22:37:45 |
8 | 2022-03-29 23:59:55 | 2022-03-30 00:00:00 |
In order to estimate SAA passage times for the BAT instrument, simply set the parameter bat = True
, e.g.:
saa = SAA('2022-03-29',bat=True)
saa
# | Begin | End |
---|---|---|
0 | 2022-03-29 00:07:23 | 2022-03-29 00:22:15 |
1 | 2022-03-29 01:52:22 | 2022-03-29 01:52:40 |
2 | 2022-03-29 01:52:51 | 2022-03-29 01:57:44 |
3 | 2022-03-29 12:16:36 | 2022-03-29 12:21:49 |
4 | 2022-03-29 12:21:55 | 2022-03-29 12:24:13 |
5 | 2022-03-29 13:52:48 | 2022-03-29 14:11:21 |
6 | 2022-03-29 15:32:12 | 2022-03-29 15:53:08 |
7 | 2022-03-29 17:12:31 | 2022-03-29 17:35:01 |
8 | 2022-03-29 18:54:06 | 2022-03-29 19:14:14 |
9 | 2022-03-29 20:36:23 | 2022-03-29 20:55:09 |
10 | 2022-03-29 22:18:12 | 2022-03-29 22:34:33 |
You will notice that the times for entry and exit differ for BAT, and the passages are usually shorter.
In order to access information on an individual pass, you can see in the tables above the first column gives the array index of each entry, therefore you can access the information about the SAA pass @ 18:54:06 by the following command:
saa[8]
Begin | End |
---|---|
2022-03-29 18:54:06 | 2022-03-29 19:14:14 |
The above is a instance of the Swift_SAA_Entry
class, which is a simple container class that contains two entries, begin
and end
, which give the beginning and end times of the SAA passage.
print(saa[8].begin)
2022-03-29 18:54:06
print(saa[8].end)
2022-03-29 19:14:14
Note that all times in the Swift_SAA
class are times in UTC. However, if you want to know when the SAA times will happen in either Mission Elapsed Time (seconds since 2001-01-01 as measured by Swift's onboard clock) or Swift Time (a simple conversion of MET to a UTC-like date format, without leap second or clock drift adjustments), you can perform a clock correction using the clock_correct()
method, e.g.:
saa.clock_correct()
saa
# | Begin (UTC) | End (UTC) |
---|---|---|
0 | 2022-03-29 00:07:23 | 2022-03-29 00:22:15 |
1 | 2022-03-29 01:52:22 | 2022-03-29 01:52:40 |
2 | 2022-03-29 01:52:51 | 2022-03-29 01:57:44 |
3 | 2022-03-29 12:16:36 | 2022-03-29 12:21:49 |
4 | 2022-03-29 12:21:55 | 2022-03-29 12:24:13 |
5 | 2022-03-29 13:52:48 | 2022-03-29 14:11:21 |
6 | 2022-03-29 15:32:12 | 2022-03-29 15:53:08 |
7 | 2022-03-29 17:12:31 | 2022-03-29 17:35:01 |
8 | 2022-03-29 18:54:06 | 2022-03-29 19:14:14 |
9 | 2022-03-29 20:36:23 | 2022-03-29 20:55:09 |
10 | 2022-03-29 22:18:12 | 2022-03-29 22:34:33 |
As you can see now the columns are explicitly listed as being UTC. You can convert to Swift Time easily, like so:
saa.to_swifttime()
saa
# | Begin (Swift) | End (Swift) |
---|---|---|
0 | 2022-03-29 00:07:51.864421 | 2022-03-29 00:22:43.864481 |
1 | 2022-03-29 01:52:50.864847 | 2022-03-29 01:53:08.864848 |
2 | 2022-03-29 01:53:19.864849 | 2022-03-29 01:58:12.864869 |
3 | 2022-03-29 12:17:04.867379 | 2022-03-29 12:22:17.867400 |
4 | 2022-03-29 12:22:23.867400 | 2022-03-29 12:24:41.867410 |
5 | 2022-03-29 13:53:16.867769 | 2022-03-29 14:11:49.867844 |
6 | 2022-03-29 15:32:40.868172 | 2022-03-29 15:53:36.868257 |
7 | 2022-03-29 17:12:59.868579 | 2022-03-29 17:35:29.868670 |
8 | 2022-03-29 18:54:34.868991 | 2022-03-29 19:14:42.869073 |
9 | 2022-03-29 20:36:51.869406 | 2022-03-29 20:55:37.869482 |
10 | 2022-03-29 22:18:40.869819 | 2022-03-29 22:35:01.869885 |
or access the MET times of individual SAA passage times, by using the met
attribute:
saa[8].begin.met
670272874.868991